﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TutorialFour
{
   /**
 * HighPassSP is a single pole high pass filter. It is not super high quality, but it gets 
 * the job done.
 * 
 * 
 *
 */
public class HighPass : IIRFilter 
{
  /**
   * Constructs a high pass filter with a cutoff frequency of <code>freq</code> that will be 
   * used to filter audio recorded at <code>sampleRate</code>.
   * 
   * @param freq the cutoff frequency
   * @param sampleRate the sample rate of audio that will be filtered
   */
	public HighPass(float freq, float sampleRate) : base(freq, sampleRate)
	{

	}

	protected override void calcCoeff() 
	{
    float fracFreq = frequency()/sampleRate();
	  float x = (float)Math.Exp(-2 * Math.PI * fracFreq);
	  a = new float[] { (1+x)/2, -(1+x)/2 };
	  b = new float[] { x };
	}
}

}
